Memory controller mapping on-the-fly

ABSTRACT

Systems, methods, and devices for dynamically mapping and remapping memory when a portion of memory is activated or deactivated are provided. In accordance with an embodiment, an electronic device may include several memory banks, one or more processors, and a memory controller. The memory banks may store data in hardware memory locations and may be independently deactivated. The processors may request the data using physical memory addresses, and the memory controller may translate the physical addresses to hardware memory locations. The memory controller may use a first memory mapping function when a first number of memory banks is active and a second memory mapping function when a second number is active. When one of the memory banks is to be deactivated, the memory controller may copy data from only the memory bank that is to be deactivated to the active remainder of memory banks

CROSS-REFERENCE TO RELATED APPLICATIONS

This application claims benefit of Provisional Application Ser. No.61/323,753, filed Apr. 13, 2010, entitled “MEMORY CONTROLLER MAPPINGON-THE-FLY,” which is incorporated by reference herein in its entirety.

BACKGROUND

The present disclosure relates generally to memory management techniquesand, more particularly, to techniques for memory mapping on-the-fly.

This section is intended to introduce the reader to various aspects ofart that may be related to various aspects of the present disclosure,which are described and/or claimed below. This discussion is believed tobe helpful in providing the reader with background information tofacilitate a better understanding of the various aspects of the presentdisclosure. Accordingly, it should be understood that these statementsare to be read in this light, and not as admissions of prior art.

Electronic devices, such as portable and desktop computers, increasinglyemploy greater quantities of memory for high performance graphics andother features. In many cases, large portions of the memory may sit idleat a given time, since such large portions of memory may be in use onlyduring memory-intensive operations, such as rending high-performancegraphics. However, even while idle, the memory and accompanyingcircuitry may consume power.

Various techniques have been developed to reduce the power consumptionof idle memory devices. For example, depending on the performance needsof the electronic device, memory and/or memory buses may be clocked at alower frequency, but may continue to draw operating power. Moreover,while certain techniques may involve shutting down power to one or morememory devices of a portable electronic device to conserve power, thesetechniques do not provide on-the-fly memory remapping and/or mayinefficiently copy data from the powered down memory to the memory thatremains. Instead, these techniques may employ inefficient memory mappingstructures, such as translation lookaside buffers (TLBs), and/or mayinvolve copying data from various portions of the memory other than theportion that is to be powered down.

SUMMARY

A summary of certain embodiments disclosed herein is set forth below. Itshould be understood that these aspects are presented merely to providethe reader with a brief summary of these certain embodiments and thatthese aspects are not intended to limit the scope of this disclosure.Indeed, this disclosure may encompass a variety of aspects that may notbe set forth below.

Present embodiments relate to systems, methods, and devices fordynamically mapping and remapping memory when a portion of memory isactivated or deactivated. In accordance with one embodiment, anelectronic device may include several memory banks, one or moreprocessors, and a memory controller. The memory banks may store data inhardware memory locations and may be independently deactivated. Theprocessors may request the data using physical memory addresses, and thememory controller may translate the physical addresses to the hardwarememory locations. The memory controller may use a first memory mappingfunction when a first number of memory banks is active and a secondmemory mapping function when a second number is active. When one of thememory banks is to be deactivated, the memory controller may copy datafrom only the memory bank that is to be deactivated to the activeremainder of memory banks

Various refinements of the features noted above may exist in relation tothe presently disclosed embodiments. Additional features may also beincorporated in these various embodiments as well. These refinements andadditional features may exist individually or in any combination. Forinstance, various features discussed below in relation to one or moreembodiments may be incorporated into other disclosed embodiments, eitheralone or in any combination. Again, the brief summary presented above isintended only to familiarize the reader with certain aspects andcontexts of embodiments of the present disclosure without limitation tothe claimed subject matter.

BRIEF DESCRIPTION OF THE DRAWINGS

Various aspects of this disclosure may be better understood upon readingthe following detailed description and upon reference to the drawings inwhich:

FIG. 1 is a block diagram of an electronic device configured to performthe techniques disclosed herein, in accordance with an embodiment;

FIG. 2 is a perspective view of an embodiment of the electronic deviceof FIG. 1 in the form of a notebook computer;

FIG. 3 is a block diagram of a memory management system employed by theelectronic device of FIG. 1, in accordance with an embodiment;

FIG. 4 is a schematic diagram of a process for dynamic memory mappingacross three banks of memory, in accordance with an embodiment;

FIGS. 5 and 6 are memory allocation diagrams, in accordance withembodiments;

FIG. 7 is a memory management factor diagram representing a variety offactors that may be considered in deciding whether to power up or down amemory bank;

FIG. 8 is a flowchart describing an embodiment of a method for balancingpower management and performance considerations based on the criteriapresented in the factor diagram of FIG. 7;

FIG. 9 is a block diagram of the memory management system of FIG. 3 whenone bank of memory and its associated memory bus is powered down, inaccordance with an embodiment;

FIG. 10 is a flowchart describing an embodiment of a method for poweringdown one bank of memory;

FIG. 11 is a schematic diagram illustrating a process for dynamic memoryremapping from three banks of memory to two banks of memory, inaccordance with an embodiment;

FIG. 12 is a flowchart describing an embodiment of a method forperforming the process of FIG. 11;

FIG. 13 is a schematic diagram illustrating a process for dynamic memoryremapping from two banks of memory to one bank of memory, in accordancewith an embodiment;

FIG. 14 is a flowchart describing an embodiment of a method for powermanagement when the electronic device of FIG. 1 is idle or thermalconstraints are considered;

FIGS. 15 and 16 are schematic diagrams illustrating a process fordynamic memory remapping from one bank of memory to two banks of memoryand from two banks of memory to three banks of memory, respectively, inaccordance with embodiments;

FIG. 17 is a flowchart describing an embodiment of a method for poweringmemory up or down depending on performance and memory considerations;

FIG. 18 is a schematic diagram of a cache line address to be mapped bythe memory management system of FIG. 3;

FIGS. 19A-C are schematic diagrams of cache line address remappingschemes employed by the memory management system of FIG. 3 when varioussegments of memory are powered down to one-half and one-fourth;

FIG. 20 is a flowchart describing an embodiment of a method for poweringdown memory that includes remapping cache line addresses in the mannerillustrated by FIGS. 19A-C;

FIGS. 21A-E are schematic diagrams of cache line address remappingschemes employed by the memory management system of FIG. 3 when varioussegments of memory are powered down to two-thirds and one-third;

FIGS. 22A-B are schematic diagrams of cache line address illustratingthat the cache line address remapping schemes of FIGS. 21A-E involveonly two bit changes;

FIG. 23 is a flowchart describing an embodiment of a method for poweringdown memory that includes remapping cache line addresses in the mannerillustrated by FIGS. 21A-E; and

FIGS. 24 and 25 are schematic diagrams illustrating a process forreading from a two-bank memory mapping and writing to both a two-bankmemory mapping and a three-bank memory mapping, respectively, inaccordance with embodiments.

DETAILED DESCRIPTION OF SPECIFIC EMBODIMENTS

One or more specific embodiments will be described below. In an effortto provide a concise description of these embodiments, not all featuresof an actual implementation are described in the specification. Itshould be appreciated that in the development of any such actualimplementation, as in any engineering or design project, numerousimplementation-specific decisions must be made to achieve thedevelopers' specific goals, such as compliance with system-related andbusiness-related constraints, which may vary from one implementation toanother. Moreover, it should be appreciated that such a developmenteffort might be complex and time consuming, but would nevertheless be aroutine undertaking of design, fabrication, and manufacture for those ofordinary skill having the benefit of this disclosure.

Present embodiments relate to power and memory management for anelectronic device. In particular, the present disclosure describestechniques for memory mapping and remapping on-the-fly and for poweringup or down one or more portions of total memory, which may be, incertain embodiments, one or more memory banks As used herein, the terms“power down”, “shut down”, and “deactivate” refer to placing memory intoany low power condition, such as turning off the memory, placing thememory in a self-refresh mode, or setting the memory to any otherlower-power-consumption mode. Among other things, thepresently-disclosed techniques describe a manner of on-the-fly memoryremapping when a portion of the available memory is powered down usingcertain disclosed mapping functions. For example, in certainembodiments, an electronic device may have three banks of memory, eachof which may have a particular memory bus. When a higher level ofperformance is desired, a memory controller may map certain physicaladdresses to hardware memory locations (also referred to herein as“storage cells” or “dual in-line memory module (DIMM) addresses”)distributed approximately evenly across all three memory banks It shouldbe appreciated that the term “physical address,” as used herein, refersto a memory chunk that is manipulable by the memory controller and maybe any suitable size. For example, when the term “physical address” isused in reference to mapping or remapping memory, the term may refer tocache lines or pages of memory that are mapped or remapped, even if thememory controller is capable of manipulating smaller chunks. That is, insome embodiments, the term “physical address,” when used in reference tothe disclosure herein, may refer to the remapping of pages of memory,even though cache lines of the pages may be individually accessiblethrough the memory controller. When data associated with the physicaladdresses is accessed, the data may be transmitted with a maximizedbandwidth over all three memory buses at once.

In such an embodiment, when power conservation is desired, alternativelyor in addition to simply reducing the clock frequency of the memorybanks and/or memory buses, one or more of the memory banks and/or busesmay be powered down (e.g., turned off, placed in a self-refresh mode,placed in a lower power consumption mode, etc.). The memory controllermay remap, on-the-fly, the remaining physical addresses to DIMMaddresses on the first two memory banks via a mathematical memorymapping function. Before shutting down the third memory bank, the memorycontroller may copy data associated with the remapped physical addressesdirectly from the third memory bank to the first two memory banks Tothat end, in some embodiments, no data may be copied from the firstmemory bank to the second memory bank, or from the second memory bank tothe first memory bank, during the remapping process. After the data fromthe third memory bank has been copied to the first two memory banks, thememory controller may cause the third memory bank and/or memory bus tobe shut down. It should be understood that the present techniques mayalso be applied to any number of memory banks and/or portions of thetotal memory.

With the foregoing in mind, a general description of suitable electronicdevices capable of using the disclosed memory management techniques isprovided below. In FIG. 1, a block diagram depicting various componentsthat may be present in electronic devices suitable for use with thepresent techniques is provided. In FIG. 2, one example of a suitableelectronic device, here provided as a notebook computer system, isdepicted. These types of electronic devices, and other electronicdevices having comparable memory management capabilities, may be used inconjunction with the present techniques.

FIG. 1 is a block diagram illustrating various components and featuresof an electronic device 10 capable of performing the techniquesdisclosed herein. In the presently illustrated embodiment, suchcomponents may include one or more processor(s) 12, memory 14,nonvolatile storage 16, a display 18, input structures 20, input/output(I/O) ports 22, a networking device 24, and a power source 26. Thevarious functional blocks shown in FIG. 1 may include hardware elements(including circuitry), software elements (including computer code storedon a non-transitory computer-readable medium) or a combination of bothhardware and software elements. It should further be noted that FIG. 1is merely one example of a particular implementation and is intended toillustrate the types of components that may be present in electronicdevice 10.

The processor(s) 12 may enable the operation of an operating system(OS), which itself may enable the use of various software to temporarilystore information in the volatile memory 14. In particular, the OSrunning on the processor(s) 12 may operate using logical memoryaddresses that may be translated by the processor(s) 12 into physicaladdresses, and the processor(s) 12 may request certain memory operationsby the memory 14 based on these physical addresses. As discussed ingreater detail below, when the memory 14 receives the physical addressesfrom the processor(s) 12, a memory controller of the memory 14 maytranslate the physical addresses to hardware memory locations of anysuitable size (e.g., lines or pages), such as dual inline memory module(DIMM) addresses, for example. The DIMM addresses may represent theactual, physical location of the stored data to which the physicaladdresses, and thus also the logical addresses, correspond. Also asdiscussed in greater detail below, the memory 14 may be capable of powerconservation by reducing the number of operational DIMMs byapproximately one-third or more and remapping, on-the-fly, thecorrespondence of the remaining physical addresses to the remaining DIMMaddresses. The number of operational DIMMs may be reduced further, inwhich case the remaining physical addresses also may be remapped to theremaining DIMM addresses.

The memory 14 may store instructions for carrying out certain aspects ofthe present techniques described herein. For example, the OS running onthe processors 12 and/or software running on the OS may perform certainalgorithms relating to the present techniques (e.g., when to enter alow-power mode, etc.). The instructions for carrying out theseinstructions may be stored, at least temporarily, in the memory 14. Suchinstructions may also be stored in the nonvolatile storage 16, which mayinclude, for example, a hard disk drive or Flash memory. The display 18may display elements of the OS or software, such as the user interface(UI) of the electronic device 10. A user may interact with theelectronic device 10 via the input structures 20, which may include akeyboard and/or a mouse or touchpad. In certain embodiments, the display18 may be a touchscreen display that serves as one of the inputstructures 20.

The I/O ports 22 of the electronic device 10 may enable the electronicdevice 10 to transmit data to and receive data from other electronicdevices 10 and/or various peripheral devices, such as external keyboardsor mice. The networking device 24 may enable personal area network (PAN)integration (e.g., Bluetooth), local area network (LAN) integration(e.g., Wi-Fi), and/or wide area network (WAN) integration (e.g.,cellular 3G or 4G). The power source 26 of the electronic device 10 maybe any suitable source of power, such as a rechargeable lithium polymer(Li-poly) battery and/or standard alternating current (AC) powerconverter.

The electronic device 10 may take the form of a computer or other typeof electronic device. Such computers may include computers that aregenerally portable (such as laptop, notebook, and tablet computers) aswell as computers that are generally used in one place (such asconventional desktop computers, workstations and/or servers). In certainembodiments, the electronic device 10 in the form of a computer may be amodel of a MacBook®, MacBook® Pro, MacBook Air®, iMac®, Mac® mini, orMac Pro® available from Apple Inc. In other embodiments, the electronicdevice 10 may take the form of a handheld or tablet device, such as amodel of an iPod®, iPhone®, or iPad® available from Apple Inc.

By way of example, the electronic device 10, taking the form of anotebook computer 28, is illustrated in FIG. 2 in accordance with oneembodiment of the present disclosure. The depicted computer 28 mayinclude a housing 30, a display 18, input structures 20, and I/O ports22. In one embodiment, the input structures 20 (such as a keyboardand/or touchpad) may be used to interact with the computer 28, such asto start, control, or operate a GUI or applications running on computer28. For example, a keyboard and/or touchpad may allow a user to navigatea user interface or application interface displayed on the display 18.

In some embodiments, the electronic device 10 may be capable ofdisplaying high-performance graphics on the display 18, which mayinvolve accessing large quantities of the memory 14 at high bandwidthsat certain times. However, at other times, the electronic device 10 maynot significantly benefit from such large amounts of the memory 14 orsuch high bandwidths. As such, the electronic device 10 may include amemory management system 34, illustrated in FIG. 3, which may enablecertain parts of the memory 14 to be shut down (e.g., turned off, placedin a self-refresh mode, placed in a lower power consumption mode, etc.)to conserve power.

As shown in FIG. 3, the processor(s) 12 may communicate with the memory14 through a memory controller 36 and a bus 38. In general, an operatingsystem (OS) running on the processor(s) 12 may allocate and deallocatememory at logical addresses. In some embodiments, a memory managementunit (MMU) 39 of the processor(s) 12 may translate the logical addressesemployed by the OS into physical addresses that generally correspond toa memory addresses understood by the memory controller 36. The MMU 39may perform this translation using one or more translation look asidebuffers (TLB) or any other suitable hardware. In some other embodiments,the OS of the processor(s) 12 may translate the logical addresses to thephysical addresses. The memory controller 36 may receive instructions toread data from or write data to one of the physical address from theprocessor(s) 12.

Contiguous physical addresses requested by the processor(s) 12 may notdirectly correspond to contiguous hardware memory locations located onmemory banks 40A, 40B, and 40C, shown in FIG. 3 as bank 0, bank 1, andbank 2. Rather, the memory controller 36 may map the physical addressesrequested by the processor(s) 12 to certain hardware memory locations,also referred to herein as “storage cells” or “dual in-line memorymodule (DIMM) addresses,” that may be distributed approximately evenlyacross all of the memory banks 40A, 40B, and 40C. The memory banks 40A,40B, and 40C may include any suitable memory devices, such as doubledata rate three synchronous dynamic random access memory (DDR3 SDRAM),double data rate three synchronous dynamic random access memory (DDR4SDRAM), and/or graphics double data rate five synchronous dynamic randomaccess memory (GDDR5 SDRAM). The memory controller 36 may communicatewith the three memory banks 40A, 40B, and 40C via memory buses 42, 44,and 46, which may respectively interconnect the memory controller 36with banks 0, 1, and 2. In alternative embodiments, the memorymanagement system 34 may include more or fewer memory buses and memorybanks 40.

As noted above, the physical addresses may not be contiguously mappedacross the DIMM addresses memory banks 40A, 40B, and 40C, but rather maybe mapped such that no two “related” or “contiguous” physical addressesare mapped to the same memory bank 40. As used herein, the terms“related” or “contiguous” physical addresses refer to physical addressesthat are likely to be accessed in succession (e.g., physical addressesmapped to contiguous software logical memory addresses by the OS), evenif the physical addresses are not strictly numerically contiguous. Thatis, depending on the capability of the memory banks 40A, 40B, and 40C toprovide access to successive DIMM addresses without further latency, afirst physical address may be mapped to a DIMM address on bank 0, asecond physical address may be mapped to a DIMM address on bank 1, andso forth. This scheme may be altered when the memory banks 40A, 40B, and40C have different bandwidth characteristics, such that a higherbandwidth memory bank may have mapped to it more than one relatedphysical address. For example, some embodiments may involve mapping thefirst and second physical addresses to DIMM addresses on bank 0 and bank1, respectively, and mapping third and fourth physical addresses to bank2. In general, the physical addresses may be distributed to DIMMaddresses of the memory banks 40A, 40B, and/or 40C to reduce latency“low points.” When large segments of physical addresses are requested bythe processor(s) 12, the memory controller 36 may, in certainembodiments, gain access to three physical addresses at a time via thethree memory buses 42, 44, and 46, which may effectively maximize thedata transfer bandwidth.

The memory controller 36 generally may map the physical addressesrequested by the processor(s) 12 to the DIMM addresses of the memorybanks 40A, 40B, and 40C such that each memory bank 40 includes as manyrelated physical addresses as possible without incurring undue latency.Therefore, if each memory bank 40 is capable of providing access only toone physical address at a time without incurring additional latency, thephysical addresses may be distributed such that no two related physicaladdresses map to two DIMM addresses on the same memory bank 40, asdiscussed above. If each memory bank 40 is capable of providing accessto no more than two physical addresses at a time without incurringadditional latency, the physical addresses may be distributed such thatno three related physical addresses map to three DIMM addresses on thesame memory bank 40.

In some alternative embodiments, the memory controller 36 may not mapthe physical addresses requested by the processor(s) 12 to the DIMMaddresses of the memory banks 40A, 40B, and 40C such that each memorybank 40 includes as many related physical addresses as possible withoutincurring undue latency, as discussed briefly above. Instead, the memorycontroller 36 may map the physical addresses to the DIMM addresses suchthat each memory bank 40 includes fewer related physical addresses thanthe maximum possible without latency. Thereafter, when the memorycontroller 36 causes a memory bank 40 and/or memory bus 42, 44, and/or46 to be shut down to conserve power, remapping the remaining physicaladdresses to the DIMM addresses of the remaining memory banks 40,additional latency may not be incurred even if two related physicaladdresses are mapped to the same memory bank 40. In other words, if eachmemory bank 40 is capable of providing access to no more than twophysical addresses at a time without incurring additional latency, thephysical addresses may be distributed such that no two related physicaladdresses map to three DIMM addresses on the same memory bank 40. Thus,as discussed in greater detail below, when the memory controller 36reduces the number of active memory banks 40A, 40B, and 40C and tworelated physical addresses then may be mapped to the same memory bank40, the memory bank 40 may not incur additional latency.

Also, in certain embodiments, not all memory buses 42, 44, and 46 mayhave the same bandwidth capabilities, and not all memory banks 40A, 40B,and 40C may operate with the same latency. Indeed, the memory banks 40A,40B, and 40C may have different signaling characteristics or differentsizes. In some embodiments, at least one memory bank 40 may be DDRmemory, while another memory bank 40 may be Flash memory. Under suchconditions, the memory controller 36 may account for such asymmetries bymapping the physical addresses to the DIMM addresses of the memory banks40A, 40B, and 40C such that each includes as many related physicaladdresses as possible (or fewer, as in the alternative embodimentsmentioned above) without incurring undue latency, though the mappeddistribution of physical addresses to DIMM addresses may not evenly bedistributed.

As will be discussed below, the memory controller 36 may control whenone or more of the memory banks 40A, 40B, and 40C and/or memory buses42, 44, and 46 are shut down (e.g., by turning off the memory, placingthe memory in a self-refresh mode, or setting the memory to any otherlower-power-consumption mode) to conserve power. When the memorycontroller 36 undertakes steps to shut down a memory bank 40A, 40B, or40C and/or one of the memory buses 42, 44, and/or 46, the memorycontroller 36 may dynamically remap a reduced set of the physicaladdresses to the DIMM addresses of the remaining memory banks 40 on thefly.

When all of the memory banks 40A, 40B, and 40C are active, the memorycontroller 36 may dynamically map physical addresses requested by theprocessors 12 to certain memory storage cells, or DIMM addresses, in thememory 14. FIG. 4 illustrates one embodiment of such a dynamic mappingscheme. In the embodiment of FIG. 4, a memory mapping diagram 48illustrates a manner in which related physical addresses may bedistributed approximately evenly across the memory banks 40A, 40B, and40C, according to a dynamic mapping function, or equations, employed bythe memory controller 36. Although the present disclosure describes aparticular memory mapping function that achieves the result illustratedin the memory mapping diagram 48, the memory controller 36 may employany mapping function that dynamically maps physical addresses to DIMMaddresses across the three memory banks 40A, 40B, and 40C in one of themanners described above. Moreover, while the present disclosuregenerally refers to mapping physical addresses to the certain hardwarememory locations, it should be understood that other memory mappingconfigurations may involve distributing pages or any other suitablegranularities of memory across multiple memory banks 40.

In the memory mapping diagram 48, a leftmost column labeled “physicaladdress” indicates physical addresses that may be requested of thememory controller 36 by the processor(s) 12. A column labeled “bank”lists each memory bank 40A, 40B, and 40C (bank 0, bank 1, and bank 2).For explanatory purposes only, each memory bank 40 holds eight memoryaddresses. In practice, it should be understood that the size of thememory banks 40 and their memory addresses may be much larger, and mayrepresent any size chunk of memory that may be manipulated by the memorycontroller 36 (e.g., a cache line or page). A column labeled “DIMMaddress” illustrates the mapping of the physical addresses to certainhardware memory locations, or DIMM addresses, on the three memory banks40A, 40B, and 40C. Thus, the DIMM address 0 may hold data associatedwith the physical address 0, the DIMM address 1 may hold data associatedwith the physical address 3, and so forth. Moreover, as noted above, thephysical addresses may not be directly, contiguously mapped to the DIMMaddresses. For clarity, however, the physical addresses may beunderstood to correspond sequentially to a quantity of memory addressesthat each memory bank 40 could hold. That is, the first eight physicaladdresses are noted via a first hatching, the second eight physicaladdresses are noted via a second hatching, and the third eight physicaladdresses are noted via a third hatching. These hatchings are intendedto more clearly illustrate how the memory controller 36 may map andremap these physical addresses to DIMM addresses across the memory banks40A, 40B, and 40C.

When the processor(s) 12 instruct the memory controller 36 to access aphysical address, the memory controller 36 may dynamically map thephysical address to its corresponding DIMM address in the memory banks40A, 40B, and 40C according to a memory mapping function. To achieve theresults of the memory mapping diagram 48, the following memory mappingfunction may be employed:

BankIndex=Floor(PAddr/TotalBanks)   (1) and

DIMMAddr=MOD(PAddr*BankSize, TotalMemory)+BankIndex   (2).

In Equations (1) and (2) above, the variable PAddr represents thephysical address listed in the leftmost column of the memory mappingdiagram 48 and the variable DIMMAddr represents the DIMM address towhich the physical address is mapped. The variable BankIndex representsan offset value for varying to which of the DIMM addresses of a memorybank 40 a physical address is mapped. The variable BankSize representsthe quantity of physical addresses per memory bank 40. The variableTotalBanks represents the total number of memory banks 40A, 40B, and 40Cand the variable TotalMemory represents the total number of DIMMaddresses. This may be referred to as strip memory, which wraps around,but offsets, physical addresses by their nominal original bank to avoidsequentially mapping to the same DIMM address.

In one example, the memory controller 36 may map the physical address“4” to the DIMM address “9” as follows:

MOD(PAddr * BankSize,TotalMemory) + BankIndex MOD(4 * 8,24) + Floor(4 /3) MOD(32,24) + 1 8 + 1 9

In another example, the memory controller 36 may map the physicaladdress “2” to the DIMM address “16” as follows:

MOD(PAddr * BankSize,TotalMemory) + BankIndex MOD(2 * 8,24) + Floor(2 /3) MOD(16,24) + 0 16 + 0 16

In this manner, the memory controller 36 may dynamically map thephysical addresses to DIMM addresses in accordance with the mappingfunction described by Equations (1) and (2). In the embodiment of thememory mapping diagram 48, based on the memory mapping function ofEquations (1) and (2), physical addresses may be mapped to DIMMaddresses in a manner that prevents sequential, related physicaladdresses from being mapped to the same memory bank 40. Thisconfiguration may generally maximize the bandwidth available when theprocessor(s) 12 request a series of sequential physical addresses whenthe memory banks are capable of accessing one DIMM addresses at a timewithout latency. In other embodiments, if a particular memory bank 40 iscapable of accessing two or more DIMM addresses at a given time withoutadditional latency, the mapping function may be adapted to distributethe physical addresses such that two or more sequential physicaladdresses map to DIMM addresses on the same memory bank 40.

In certain embodiments, despite that the memory banks 40A, 40B, and 40Cmay be capable of accessing two or more DIMM addresses at a given timewithout additional latency, the memory controller 36 may still employthe mapping function described above. In so doing, when the memorycontroller 36 causes one of the memory banks 40A, 40B, and 40C and/orone of the memory buses 42, 44, and 46 to be shut down to conservepower, and remaps the remaining physical addresses to the DIMM addressesof the remaining memory banks 40A, 40B, and 40C, latency may notsignificantly increase, even when two related physical addresses aresubsequently mapped to the same memory bank 40.

The electronic device 10 may use various quantities of the memory 14 atdifferent points in time. In particular, memory associated with graphicsmay be very volatile, used in highly variable quantities at differenttimes. FIGS. 5 and 6 represent schematic diagrams illustrating suchvariations in memory usage. Turning first to FIG. 5, a memory usagediagram 50 represents the total amount of memory available across thethree memory banks 40A, 40B, and 40C. In-use memory 52 may store dataassociated with, among other things, a screen on the display 18, acursor, windows that may have animation, assembly buffers, and so forth.The in-use memory 52 may not occupy all of the total available memory,however, as a certain amount of unused memory 54 may remain in thememory banks 40A, 40B, and 40C. As shown in the memory usage diagram 50,the total amount of memory currently in active or frequent use by theelectronic device 10 may span more than the total quantity of memoryavailable to two of the memory banks 40A, 40B, and 40C. As such, allthree memory banks 40A, 40B, and 40C may be employed. During situationsin which the memory usage is as shown in FIG. 5, the memory mappingfunction employed by the memory controller 36 may map physical addressesto DIMM addresses located across the three memory banks 40A, 40B, and40C.

At other times during the operation of the electronic device 10, lessmemory may be employed. For example, as shown in FIG. 6, a memory usagediagram 56 may include a smaller amount of in-use memory 52 and a largeramount of unused memory 54. In the memory usage diagram 56, the amountof in-use memory 52 may span more than one memory bank 40 but less thanall three memory banks 40A, 40B, and 40C.

As the memory usage of the electronic device 10 changes, the electronicdevice 10 may sufficiently operate with less memory bandwidth and/orwith less total memory. Accordingly, based on certain criteria, theelectronic device memory management system 34 may take steps to reducethe amount of power consumed by the memory 14. A memory managementfactor diagram 58 of FIG. 7 illustrates several such device memoryoperation criteria 60, which may include, among other things,indications by performance counters 62, an operational state 64 of theelectronic device 10, a memory usage history 66 of the electronic device10, an expected memory usage 68 of the electronic device 10, thermallimitations 70 of the electronic device 10, GPU memory stalls 72, pagingactivities 74, and/or user preferences 76.

Representing one criterion that may indicate whether more or less memoryshould be available to the electronic device 10, the performancecounters 62 may represent a continuous monitoring by the operatingsystem (OS) of the system performance of the electronic device 10. Forexample, the performance counters 62 may indicate how much processing istaking place at a given time and/or may provide a recent history of howsystem resources have been consumed. A higher consumption of processingresources, as indicated by the performance counters 62, may signal thatthe available memory resources should be increased, if possible.Similarly, a reduced consumption of processing resources may signal thatthe available memory resources should be reduced, if possible.

Another criterion that may indicate whether more or less memory shouldbe available to the electronic device 10 may be the operational state 64of the electronic device 10. In some embodiments, the operational state64 may be determined based on the performance counters 62, and mayrepresent, for example, whether the electronic device 10 is operating inan active, high performance, or idle state. Additionally oralternatively, the operational state 64 may indicate whether theelectronic device 10 is operating in a reduced power state, for example,because the power source 26 has changed from an external AC source to abattery source or because battery power is low. Certain operationalstates 64 (e.g., an active state) may signal that the available memoryresources should be increased, if possible. Other operational states 64(e.g., an idle state) may signal that the available memory resourcesshould be reduced, if possible.

Because past memory usage may be indicative of likely future memoryusage, the memory usage history 66 and expected memory usage 68 mayrepresent criteria for determining whether more or less memory should bemade available to the electronic device 10. The memory usage history 66may represent recent historical memory usage (e.g., memory usage of theprior 1 minute, 2 minutes, 5 minutes, 10 minutes, 20 minutes, 1 hour,etc.) and/or may represent memory usage patterns for extended periods oftime (e.g., memory usage over prior days, weeks, months, and/or the lifeof the electronic device 10). Expected memory usage 68 may derive fromthe memory usage history 66 or may be based on typical patterns ofmemory use for the electronic device 10. The memory usage history 66and/or the expected memory usage 68 may signal whether the availablememory resources should be increased or reduced, depending on whethermore or less memory is in use or expected to be in use.

The memory usage history 66 and/or the expected memory usage 68 may beillustrated by the following examples. In a first example, the operatingsystem (OS) of the electronic device 10 may recognize when certainapplication programs with known memory consumption histories arelaunched. When an application that has historically consumed largequantities of memory is launched, the OS or the application may providean indication that a relatively large quantity of memory may be consumedin the near future. In another example, the electronic device 10 maypredict when large quantities of memory are typically needed for use bythe user based on the user's historical usage patterns. For example, theelectronic device 10 may recognize that on Tuesday morning theelectronic device 10 typically performs a significant quantity of imageprocessing, or that on Thursday evening, the electronic device 10 isused to play memory-intense 3-D games. As such, on Tuesday morning andThursday evening, the memory usage history 66 and the expected memoryusage 68 may weigh significantly in favor of increasing available memoryresources. In a third example, an application currently running on theelectronic device 10 may provide a cue to indicate that a relativelylarge amount of memory is about to be needed in the near future or thata relatively low amount of memory is about to be needed in the nearfuture. Based on such cues, the expected memory usage 68 (e.g., asdetermined by the OS of the electronic device 10) may weigh in favor ofincreasing or decreasing the currently available memory as needed. In afourth example, the OS may follow the allocation patterns of memory todetermine when large patterns of memory allocation have occurred in thepast and may be likely to occur in the future.

Another criterion that may indicate whether more or less memory shouldbe made available to the electronic device 10 may be thermal limitations70 that are placed on the electronic device 10. Due to external heatfrom the environment and internal heat generated by components of theelectronic device 10, particularly after extended periods of highperformance operation, the electronic device 10 may approach the thermallimitations 70. If such thermal limitations 70 are approached, theelectronic device 10 may be more likely to determine that the availablememory resources should be reduced. With reduced memory resourcesgenerating heat, the amount of internally-generated heat may accordinglybe reduced and the electronic device 10 may retreat from the thermallimitations 70.

In some embodiments, device memory stalls, such as CPU or GPU memorystalls 72, or memory stalls by any other data processing circuitry ofthe electronic device 10, and memory paging activities 74 may indicatewhether more or less memory should be made available to the electronicdevice 10. The presence of GPU memory stalls 72 may indicate that morememory should be made available, while the lack of such GPU memorystalls 72 may indicate that the electronic device 10 currently has anexcess supply of memory. Likewise, memory paging activities 74 mayindicate a degree to which the available memory is or is not in activeor frequent use.

A further criterion that may indicate whether to increase or decreasethe available memory resources of the electronic device 10 may be userpreferences 76. For example, the user of the electronic device 10 mayindicate a preference for increased battery life over high performance,or vice versa. Similarly, the user may elect to cause the electronicdevice 10 to enter a lower or higher memory consumption mode. In anotherexample, the electronic device 10 may be capable of use by multipleusers, and different users may operate the electronic device 10 indifferent ways. That is, some users may generally employ memory-intenseapplications, while others may generally employ applications thatconsume relatively little memory. By tracking user memory-consumptionbehavior, the electronic device 10 may determine each user's preferences76. Thereafter, when the user is using the electronic device 10, theuser preferences 76 may weigh in favor of increasing or decreasing theavailable memory.

As noted above, the electronic device 10 may consider the memoryoperation criteria 60 in determining how to manage the memory 14 of theelectronic device 10. One embodiment of a method for managing the memory14 based on such criteria 60 appears in a flowchart 80 of FIG. 8. In afirst block 82, the electronic device 10 (e.g., the memory controller36, the processor(s) 12, the OS running on the processor(s) 12, and/orsoftware running on the OS) may consider some or all of the memoryoperation criteria 60. In some embodiments, the criteria 60 may beweighed against one another to ascertain whether, on balance, electronicdevice 10 memory usage is excessive or insufficient, or is expected tobecome excessive or insufficient in the future. In some embodiments,certain criteria 60 may be given different weights and/or certaincriteria 60 may override all others (e.g., thermal limitations 70 mayreceive priority when heat becomes excessive).

As illustrated by decision block 84, if available memory is determinedto be in excess or is expected to be in excess in the near future (e.g.,as of the time needed to remap and deactivate excess memory), theelectronic device 10 may consider whether the excessiveness of thememory usage has crossed a threshold justifying the deactivation of oneor more portions of the memory 14 in decision block 86. By way ofexample, when a user elects to close a high-memory-consumingapplication, the electronic device 10 may determine that the currentlyavailable memory is expected to be excessive once the application hasclosed. The threshold may include a time component, which may representa length of time that the memory usage has been excessive, and/or mayinclude a quantitative component, which may represent the extent towhich the memory usage is deemed in excess. In some embodiments, thethreshold may represent an amount of total excess memory usage and/or anamount of time that the amount of in-use memory has remained below acertain number of portions of the memory 14 (e.g., usage of less than 2memory banks 40, as shown in FIG. 6). If the threshold has not beenreached in decision block 86, the electronic device 10 may reduce somepower consumption by reducing the clock speed and/or operating voltageof the memory banks 40A, 40B, and/or 40C and/or their associated memorybuses 42, 44, and/or 46 in block 88 to place them into a reduced powerconsumption mode. If the threshold has been reached in decision block86, the electronic device 10 may reduce additional power consumption bydeactivating one of the memory banks 40A, 40B, and/or 40C and/or theirassociated memory buses 42, 44, and/or 46 in block 90. A more detaileddescription of how such deactivation may take place is described below.

The process of decision blocks 84 and 86 to block 90, when one or morememory banks 40 are powered down, may be carried out in a variety ofother manners. In some embodiments, logic associated with the memorycontroller 36 may initiate the shut-down process when the memory usageof the electronic device 10 has been reduced to a total number ofphysical addresses that may be mapped to DIMM addresses in a fewernumber of memory banks 40A, 40B, and 40C than currently in use. To doso, in certain embodiments, the operating system (OS) running on theprocessor(s) 12, or software running on the OS, may follow decisionblocks 84 and 86 above to determine when to power down a memory bank 40.The OS may then instruct the processor(s) 12 to send a control signal tothe memory controller 36, causing the shut-down process to begin inblock 90.

In other embodiments, the processor(s) 12 may automatically detect whenthe memory usage has fallen to encompass fewer memory banks 40A, 40B,and 40C than currently in use. For example, the MMU 39 may periodicallyor continuously provide to the processor(s) 12 an indication of thetotal number of logical addresses that are currently in use and/ormapped to physical addresses. Thereafter, the processor(s) 12 may send acontrol signal to the memory controller 36 to initiate the shut-downprocess.

In certain other embodiments, logic associated with the memorycontroller 36 may automatically detect when fewer memory banks 40A, 40B,and 40C should be used by monitoring which physical addresses are beingrequested by the processor(s) 12. For example, if no physical addressesextending beyond bank 1 are requested by the processor(s) 12 for athreshold period of time (e.g., 10 seconds, 20 seconds, 1 minute, 2minutes, 5 minutes, 10 minutes, 20 minutes, etc.), the memory controller36 may understand that these physical addresses are not needed, and maythus initiate the shut-down process automatically.

Returning to decision block 84, if the memory usage of the electronicdevice 10 is not determined to be in excess, the electronic device 10may determine, in decision block 92, whether the total memory currentlyavailable is insufficient in light of the memory operation criteria 60.In decision block 94, the electronic device 10 may consider whether theinsufficiency of the memory usage has crossed a threshold justifying thereactivation of one or more portions of the memory 14 that havepreviously been shut down. Such a threshold may include a timecomponent, which may represent a length of time that the memory usagehas been insufficient, and/or may include a quantitative component,which may represent the extent to which the memory usage is deemedinsufficient. In some embodiments, the threshold may represent an amountof total memory usage and/or an amount of time that the amount of in-usememory has remained above a limit approaching a certain number ofportions of the memory 14 (e.g., usage of nearly all of 2 memory banks40, when one memory bank 40 has been shut down).

If the threshold has not been reached in decision block 94, theperformance of the electronic device 10 may be increased, withoutsignificantly increasing power consumption, by increasing the clockspeed and/or operating voltage of the memory banks 40A, 40B, and/or 40Cand/or their associated memory buses 42, 44, and/or 46 in block 96. Ifthe threshold has been reached in decision block 94, the electronicdevice 10 may reactivate one of the memory banks 40A, 40B, and/or 40Cand/or their associated memory buses 42, 44, and/or 46, which previouslymay have been shut down, in block 98. If the criteria 60 indicateneither that the memory usage is excessive in decision block 84, northat the memory usage is insufficient in block 92, the electronic device10 may not substantially change the configuration of the memory 14, asindicated by block 100.

As noted above, one or more portions of the memory 14 may be deactivatedto conserve power. In some embodiments, as illustrated by FIG. 9, suchportions of the memory 14 may include one or more memory banks 40. Inparticular, FIG. 9 illustrates a manner by which the memory managementsystem 34 may conserve power by causing the memory bank 40C (bank 2)and/or the associated memory bus 46 to be shut down, after remapping andcopying certain physical addresses from the memory bank 40C to theremaining memory banks 40A and 40B. In FIG. 9, the memory controller 36is illustrated as having caused memory bank 40C (bank 2) and theassociated memory bus 46 to shut down. However, it should be understoodthat the memory controller 36 may alternatively cause any other of thememory banks 40A or 40B and/or memory buses 42 or 44 to be shut down,depending on design considerations and/or an operational status of theelectronic device 10. Moreover, while one entire memory bank 40C isillustrated as having been shut down, in some embodiments, the memorycontroller 36 may cause only a portion of the memory bank 40C to be shutdown.

The memory controller 36 may cause the selected memory bank 40C and/ormemory bus 46 to shut down in any suitable manner. For example, in oneembodiment, the memory bank 40C may be capable of shutting down upon thereceipt of a specific control signal or instruction from the memorycontroller 36. Additionally or alternatively, the memory controller 36may cause a power supply to the selected memory bank 40 to be cut offby, for example, directing a switch (not shown) to cut off power.

One embodiment of a method for carrying out the memory shut-down processis illustrated by a flowchart 110 of FIG. 10. In a first block 112, thememory controller 36 may begin the process of powering down one of thememory banks 40A, 40B, or 40C and/or a memory bus 42, 44, or 46. Asnoted above with reference to FIG. 8, the memory controller 36, theprocessor(s) 12, the OS running on the processor(s) 12, and/or softwarerunning on the OS may determine whether to shut down one of the memorybanks 40A, 40B, or 40C based on one or more of the memory operationcriteria 60. By way of example, block 112 may occur after the OSdetermines that its working set of memory is or could be made smallenough not to use memory from one of the memory banks 40A, 40B, or 40C.In some embodiments, the OS then may stop using an amount of memoryequal to that of one of the memory banks 40A, 40B, or 40C. For example,if each of the memory banks 40A, 40B, and 40C have the same capacity,the OS may stop using one-third of the memory.

After a determination has been made to begin the shut-down process inblock 112, the memory controller 36 may select which of the memory banks40A, 40B, or 40C to shut down in block 114. In some embodiments, thememory controller 36, the processor(s) 12, the OS running on theprocessor(s) 12, and/or software running on the OS may select forshutdown one of the memory banks 40A, 40B, and 40C in a certain order.For example, if all memory banks 40A, 40B, and 40C are currently active,bank 2 may be selected for shut-down; if only two of the memory banks40A, 40B, and 40C are currently active, bank 1 may be selected forshut-down. By way of example, the OS may call the memory controller 36to cause the memory bank 40A, 40B, or 40C to be shut down (e.g., turnedoff or placed into a self-refresh mode).

Alternatively, in block 114, the memory controller 36, the processor(s)12, the OS running on the processor(s) 12, and/or software running onthe OS may determine which memory bank 40 and/or memory bus 42, 44, or46 to shut down based on power consumption factors balanced withbandwidth factors. For example, certain of the memory banks 40A, 40B,and 40C and/or memory buses 42, 44, and 46 may have higher bandwidthcapabilities, but may consume more power. When bandwidth concernsoutweigh power consumption concerns, the memory controller 36 may selecta lower-bandwidth memory bank 40 and/or memory bus 42, 44, or 46 to shutdown, conserving some power but preserving a greater amount of memorybandwidth. When power consumption concerns outweigh bandwidth concerns,the memory controller 36 may instead select a higher-bandwidth memorybank 40 and/or memory bus 42, 44, or 46 to shut down.

As will be described in greater detail below, in block 116, the memorycontroller 36 may remap the remaining, or active, physical addresses toDIMM addresses and copy the data from the memory bank 40 selected to beshut down prior to shutting down the selected memory bank 40. Afterremapping and copying, in block 118, the memory controller 36 may causethe selected memory bank 40 and/or memory bus 42, 44, or 46 to shut downin any suitable manner. For example, in one embodiment, the memory bank40 may capable of shutting down upon the receipt of a specific controlsignal or instruction from the memory controller 36. Additionally oralternatively, the memory controller 36 may cause a power to theselected memory bank 40 to be cut off by, for example, directing aswitch (not shown) to cut off power.

Turning to FIG. 11, a memory mapping diagram 120 illustrates a manner ofdynamically remapping from the three-bank mapping scheme to a two-bankmapping scheme on the fly, as employed during block 116 of FIG. 10. Acolumn labeled “Physical Address” lists physical addresses. Physicaladdresses no longer in use (e.g., 16-23), which may be referred to as“inactive physical addresses,” are illustrated with dashed formatting. Acolumn labeled “Bank” lists the memory banks 40A, 40B, and 40C (bank 0,bank 1, and bank 2), which, for explanatory purposes only, are shown tohold eight DIMM addresses. In practice, it should be understood that thesize of the memory banks 40 and their memory addresses may be muchlarger, and may represent any size chunk of memory that may bemanipulated by the memory controller 36 (e.g., a cache line or page).The memory bank 40 that is to be shut down (e.g., bank 2) is illustratedwith dashed formatting. A column labeled “DIMM Address (3 Banks)”illustrates the original mapping of physical addresses to certainhardware memory storage locations, or DIMM addresses, on the threememory banks 40A, 40B, and 40C. A column labeled “DIMM Address (2Banks)” illustrates a remapping of the active physical addresses tocertain hardware memory storage locations, or DIMM addresses, when thenumber of active memory banks 40 is reduced from three to two.

Prior to remapping, the OS running on the processor(s) 12, softwarerunning on the operating system (OS), or the processor(s) 12 (e.g., insome embodiments, the MMU 39) may arrange the in-use physical addressessuch that the in-use physical addresses are outside the area of memoryto be powered down. For example, certain wired physical addresses orpages may be cleared out. Thereafter, the OS, the software, and/or theprocessor(s) 12 may cause the memory controller 36 to receive a commandto begin the dynamic remapping process. Additionally or alternatively,the memory controller 36 may automatically determine to begin thedynamic remapping process as discussed above.

The memory controller 36 may employ an alternative dynamic memorymapping function to remap the in-use physical addresses that have beenmapped, in the three-bank mapping scheme, to DIMM addresses of the thirdmemory bank 40. The alternative memory mapping function may be anysuitable function that maintains the mapping of the active physicaladdresses located on the memory banks 40A, 40B, and 40C that will remainin use, while remapping DIMM addresses that map, in the three-bankscheme, to inactive physical addresses. In the example of the memoryremapping diagram 120, the memory banks 0 and 1 are to remain active,and the active physical addresses (e.g., 0-15) mapped to DIMM addresseson banks 0 and 1 may not change. When a DIMM address of one of theactive memory banks 40A, 40B, and 40C is mapped to an inactive physicaladdress (e.g., 16-23), the memory controller 36 may remap these DIMMaddresses on-the-fly. An alternative memory mapping function for theremaining physical addresses may include the following relationships:

ALT_DIMMAddr3_2 = If(DIMMAddr < ReducedMemory3_2, Then DIMMAddr, ElseIf(BankReindex3_2 < FirstBankEntries3_2, (3), Then FirstBankOffset3_2 +BankReindex3_2, Else SecondBankOffset3_2 + BankReindex3_2)) where:BankReindex3_2 = If(DIMMAddr < ReducedMemory3_2, Then −1, (4); ElseDIMMAddr − ReducedMemory3_2) FirstBankEntries3_2 = Floor(BankSize /TotalBanks) (5); FirstBankOffset3_2 = Floor(ReducedBanks3_2 * BankSize /TotalBanks) (6); and SecondBankOffset3_2 = FirstBankEntries3_2 +BankSize −Floor(BankSize / TotalBanks) + 3 (7).

In Equations (3)-(7) above, the variable ALT_DIMMAddr3_2 represents thealternative DIMM address mapping for the two-bank mapping scheme, thevariable DIMMAddr represents the DIMM address mapping for the three-bankmapping scheme, and ReducedMemory3_2 represents the newly reducedquantity of DIMM addresses available across the remaining active memorybanks 40A, 40B, and 40C. The variable BankReindex3_2 is employed, incombination with the variables FirstBankEntries3_2 , FirstBankOffset3_2,and SecondBankOffset3_2 to ascertain the alternative DIMM addressmapping. Used in determining these variables, the variable BankSizerepresents the quantity of physical addresses per memory bank 40, thevariable TotalBanks represents the total number of memory banks 40A,40B, and 40C, and the variable ReducedBanks3_2 represents the number ofmemory banks 40A, 40B, and 40C remaining once the selected memory bank40 is shut down.

As noted above with reference to FIG. 4, and as also illustrated in FIG.11, under a three-bank memory mapping scheme, the physical address “4”maps to DIMM address “9.” In a two-bank memory mapping mode, using thealternative memory mapping function of Equations (3)-(7), the physicaladdress “4” may continue to be mapped to the DIMM address “9.” Bycontrast, the physical address “2” may be remapped from the DIMM address“16,” which is located on the memory bank 40 that is to be shut down(e.g., bank 2), to the DIMM address “6.”

The memory controller 36 may employ a copy function 122 to copy the datafrom the soon-to-be-shut-down memory bank 40 (e.g., bank 2) into thenewly remapped memory banks 0 and 1. In copying the memory data, thememory controller 36 may simply write over the data in the remappedaddresses of the banks 0 and 1. By way of example, the memory controller36 may read data from the DIMM addresses of the soon-to-be-shut-downmemory bank 40 that correspond to the remaining active physicaladdresses. The memory controller 36 may then write the data to eitherthe alternative DIMM address or both the alternative DIMM address andthe original DIMM address. It should be noted that the copy function 122may efficiently transfer the data from bank 2 to banks 0 and 1 withoutother intermediate copying steps, such as copying from any of the activebanks 0 or 1. Finally, it should be noted that the memory remappingprocess that may take place as shown in the memory remapping diagram 120may not involve any action on the part of a translation look asidebuffer (TLB) of the MMU 39 of the processor(s) 12, but rather may takeplace dynamically with only the memory controller 36 performingremapping and copying in a rapid, efficient manner.

The memory bank 40 to be shut down (e.g., bank 2) may continue to beaccessible while the remapping is taking place. Since the data stored onthe memory bank 40 to be shut down (e.g., bank 2) is written into boththe three-bank DIMM address mapping and two-bank DIMM address mapping(e.g., written to hardware memory locations on banks 0, bank 1, and bank2), the data on the memory bank 40 to be shut down will remainaccessible at the three-bank DIMM address mapping until the memory bank40 is actually shut down. Moreover, it should be understood that thisprincipal of remapping may be extended to any reduced number of memorybanks 40, and not only the case from three memory banks 40 to two memorybanks 40. That is, until the memory bank 40 to be shut down (e.g., bank2) is finally shut down, the memory controller 36 may continue tooperate in the two-bank DIMM address mapping. Because the memorycontroller 36 continues to operate in the two-bank DIMM address mapping,the remapping operation may be aborted at any time before the memorybank to be shut down (e.g., bank 2) is finally shut down.

In certain embodiments, the memory controller 36 may swap, rather thandestructively copy, the data from the soon-to-be-shut-down memory bank40 (e.g., bank 2) into the newly remapped memory banks 0 and 1. By wayof example, physical address 2 may be swapped with the physical address18, the physical address 5 with 21, and so forth. Although performingsuch a swap function rather than a copy function may involve additionalmemory buffer(s) to hold the physical addresses being swapped while theswap is taking place, swapping may enable the data from physicaladdresses not currently in use to be available in the future.Specifically, the memory bank 40 to be shut down may be placed into aself-refresh mode, which may consume relatively little power but maypreserve the data stored within the memory bank 40. At a later time,when the memory bank 40 is to be activated again and remapping occurs,the originally swapped physical addresses may be swapped back.

Moreover, as noted above, in some embodiments, the original 3-bankmemory mapping function of Equations (1) and (2) may be calculated todistribute the physical memory addresses across the DIMM addresses suchthat each memory bank 40 includes fewer related physical addresses thanthe maximum possible without latency. Thereafter, using the alternativemapping function of Equations (3)-(7), the memory bank 40 may not incuradditional latency, even if two related physical addresses are mapped tothe same memory bank 40. Thus, two related physical addresses may bemapped to the same memory bank 40 based on the alternative mappingfunction, but may not significantly increase the latency of the memory14.

Turning to FIG. 12, a flowchart 124 describes an embodiment of a methodfor carrying out the process shown in the memory remapping diagram 120.In a first block 126, the memory management system 34 may initiateentrance to a two-bank memory mapping mode. In block 128, the memorycontroller 36 may employ the alternative memory mapping function ofEquations (3)-(7) when physical addresses are received from theprocessor(s) 12. In block 130, the memory data of the remaining activephysical addresses on memory bank 2 may be copied onto the newlyremapped memory addresses of memory banks 0 and 1, as illustrated in thememory mapping diagram 120. In one embodiment, the memory controller 36may only read data from the DIMM addresses of the memory bank 40 to beshut down, but may write the data back to the three-bank DIMM addressesand to the two-bank DIMM addresses. While such copying takes place, thememory controller 36 may continue to operate in the three-bank memorymapping mode, asynchronously transitioning toward the two-bank memorymapping mode, provided each copy is atomic (i.e., each read of a givenDIMM address is accompanied by writes back to the two DIMM addresses).That is, from the point of view of the operating system (OS), the memorycontroller 36 appears to be operating in the two-bank memory mapping.From the perspective of the OS, the OS is merely employing a reducedaddress space. Indeed, all reads and writes may occur as expected whilethe transition from the three-bank memory mapping to the two-bank memorymapping is taking place. In this way, the memory may be remappeddynamically and on-the-fly without excessive copying. Thus, if thememory controller 36 needs to perform other operations on the memorystored in the memory banks 40 for another purpose, the copying of block130 may pause while the memory controller 36 performs such otheroperations. When the other operations have ended, the atomic copying ofblock 130 may continue until complete. Thereafter, as discussed abovewith reference to block 118 of FIG. 10, the selected memory bank 40 maybe shut down. In certain embodiments, the memory controller 36 may carryout these techniques in a manner unseen by the processor(s) 12 oroperating system (OS). In some embodiments, the OS may cause the memorycontroller 36 to perform certain or all of the blocks 126, 128, and 130(e.g., the OS may cause atomic copies in block 130).

In one embodiment, the memory controller 36 may identify the physicaladdress mapped to a DIMM address in the memory bank 40 to be shut downby applying the following relationship:

DIMMAddrBank=Floor(DIMMAddr/BankSize)   (8) and

PAddr=MOD(DIMMAddr*TotalBanks, TotalMemory)±DIMMAddrBank   (9),

where the variable DIMMAddr represents the DIMM address to which thephysical address is mapped and the variable PAddr represents thephysical address. The variable DIMMAddrBank represents an offset value.The variable BankSize represents the quantity of physical addresses permemory bank 40, the variable TotalBanks represents the total number ofmemory banks 40A, 40B, and 40C, and the variable TotalMemory representsthe total number of DIMM addresses.

By way of example, the DIMM address “16” on bank 2 maps to the physicaladdress “2,” in accordance with Equations (8) and (9) above. Since theDIMM address “16” holds data associated with the physical address “2,”which is among the physical addresses to remain active, the memorycontroller 36 may read the DIMM address “16” and copy the data storedtherein onto the alternative DIMM address mapping for the physicaladdress “2” as well as the original DIMM address mapping for thephysical address “2.” The memory controller 36 may continue to assesseach of the DIMM addresses of the memory bank 40 to be shut down (e.g.,bank 2) until an inactive physical address (e.g., “17”) is determined.Moreover, the memory bank 40 to be shut down (e.g., bank 2) may continueto be accessible while the remapping is taking place. Since the datastored on the memory bank 40 to be shut down (e.g., bank 2) isdestructively copied and written into both the alternative DIMM addressmapping and original DIMM address mapping, the data on the memory bank40 to be shut down will remain accessible at that original DIMM addressmapping until the memory bank 40 is actually shut down, at which thememory controller 36 may follow the alternative DIMM address mappingscheme. It should further be appreciated that this principal ofremapping may be extended to any reduced number of memory banks 40.

In general, after transitioning from a memory mapping that includes morememory banks 40 to a memory mapping that includes fewer memory banks 40,such as from the three-bank memory mapping to a two-bank memory mapping,one or memory banks 40 may be inactive. However, in certain embodiments,such as the embodiment shown in FIGS. 24 and 25, the previously shutdown memory bank 40 (e.g., bank 2) may be powered on briefly at certaintimes. In particular, data may be read from the DIMM address defined bya two-bank memory mapping, but may be written to the DIMM addressesdefined by a three-bank memory mapping and the two-bank memory mapping.In this way, the third bank may be inactive at least some of the time(e.g., in self-refresh mode while not being written to), saving power.However, when the memory controller 36 switches back to the three-bankmapping, the copying of data back to the three-bank mapping of DIMMaddresses will have already occurred, saving time. Such an embodimentmay be particularly useful for asymmetric, read-dominated circumstances.

FIGS. 24 and 25 illustrate the alternative memory mapping 120, which isdescribed in greater detail above with reference to FIG. 10. As such,this discussion is not reproduced here. In the embodiment shown in FIGS.24 and 25, only bank 0 and bank 1 are active and the memory controller36 is generally operating in a two-bank memory mapping. That is, in theexample shown in FIG. 24, when the memory controller 36 opts to performa read operation 244 to read the physical address “2,” the memorycontroller only reads from the DIMM address “6” that maps to thephysical address “2” in the two-bank memory mapping. The memory bank 2may remain inactive when data is being read, saving power.

As shown in FIG. 25, when the memory controller 36 opts to write data tothe memory banks 40, the memory controller 36 may write the data notonly to the two-bank memory mapping, but also to the three-bank memorymapping. To do so, the memory bank 2 may be activated at leasttemporarily. In the example of FIG. 25, when the memory controller 36opts to perform a write operation 246 to write the physical address “2,”the memory controller may write not only to the DIMM address “6” on bank0, but also to the DIMM address “16” on bank 2. If the memory controller36 later transitions from the two-bank memory mapping to the three-bankmemory mapping, the data from the DIMM address “6” need not be copied tothe DIMM address “16,” because the content of the physical address “2”already is located in the DIMM address “16.”

The process of dynamic memory remapping illustrated in FIG. 11 may beextended to reduce the amount of active memory further, as shown by amemory mapping diagram 140 of FIG. 13. The memory mapping diagram 140illustrates a reduction in memory use from two memory banks 40A, 40B,and 40C to one memory bank 40. A column labeled “Physical Address” listsphysical addresses. Physical addresses no longer in use (e.g., 8-24),which may be referred to as “inactive physical addresses,” areillustrated with dashed formatting. A column labeled “Bank” lists thememory banks 40A, 40B, and 40C, each of which, for explanatory purposesonly, hold eight DIMM addresses. In practice, it should be understoodthat the size of the memory banks 40 and their memory addresses may bemuch larger, and may represent any size chunk of memory that may bemanipulated by the memory controller 36 (e.g., a cache line or page).The memory bank 40 that is to be shut down (e.g., bank 1) and the memorybank 40 previously shut down are illustrated with dashed formatting. Acolumn labeled “DIMM Address (2 Banks)” illustrates the two-bank memorymapping scheme of FIG. 11. A column labeled “DIMM Address (1 Bank)”illustrates a remapping of the active physical addresses to certain DIMMaddresses, when the number of active memory banks 40A, 40B, and 40C isreduced from two to one.

The memory controller 36 may carry out the memory mapping procedureoutlined in the memory mapping diagram 140 in a similar manner to themethods discussed above with reference to FIGS. 10 and 12. The memorycontroller 36 may employ another alternative dynamic memory mappingfunction to remap the in-use physical addresses that have been mapped,in the two-bank mapping scheme, to DIMM addresses of the second memorybank 40, which will be shut down. The alternative memory mappingfunction may be any suitable function that maintains the mapping of theactive physical addresses located on the memory bank 40 that will remainin use, while remapping DIMM addresses that map, in the two-bank scheme,to inactive physical addresses. In the example of the memory remappingdiagram 140, the memory bank 0 is to remain active, and those of theactive physical addresses (e.g., 0-7) mapped to DIMM addresses on bank 0may not change. When a DIMM address the active memory bank 40 is mappedto an inactive physical address (e.g., 8-23), the memory controller 36may remap these DIMM addresses on-the-fly. A second alternative memorymapping function for the remaining physical addresses may include thefollowing relationships:

ALT_DIMMAddr2_1 = If(ALT_DIMMAddr3_2 < ReducedMemory2_1, ThenALT_DIMMAddr3_2, Else If(BankReindex2_1 < FirstBankEntries2_1, (10),Then FirstBankOffset2_1 + Bank_Reindex2_1, Else BankReindex2_1)) where:BankReindex2_1 = If(ALT_DIMMAddr3_2 < ReducedMemory2_1, Then −1, (11);Else ALT_DIMMAddr3_2 − ReducedMemory2_1) FirstBankEntries2_1 =Floor(BankSize / TotalBanks) + 1 (12); and FirstBankOffset2_1 =Floor(ReducedBanks2_1 * BankSize / TotalBanks) + 1 (13).

In Equations (10)-(13) above, the variable ALT_DIMMAddr2_1 representsthe alternative DIMM address mapping for the one-bank mapping scheme,the variable ALT_DIMMAddr3_2 represents the alternative DIMM addressmapping for the two-bank mapping scheme, and ReducedMemory2_1 representsthe newly reduced quantity of DIMM addresses available across theremaining active memory banks 40A, 40B, and 40C. The variableBankReindex2_1 is employed, in combination with the variablesFirstBankEntries2_1, and FirstBankOffset2_1 to ascertain the alternativeDIMM address mapping. Used in determining these variables, the variableBankSize represents the quantity of physical addresses per memory bank40, the variable TotalBanks represents the total number of memory banks40A, 40B, and 40C, and the variable ReducedBanks2_1 represents thenumber of memory banks 40A, 40B, and 40C remaining once the selectedmemory bank 40 (e.g., bank 1) is shut down.

As noted above with reference to FIG. 11, under the two-bank memorymapping scheme, the physical address “4” may still map to DIMM address“9.” Based on Equations (10)-(13), as shown in FIG. 11, the physicaladdress “4” may be remapped to DIMM address “4” in the one-bank memorymapping scheme. Similarly, the physical address “2,” mapped to DIMMaddress “6” in the two-bank memory mapping scheme, may remain mapped toDIMM address “6” in the one-bank memory mapping scheme. After enteringthe one-bank memory remapping mode, the memory controller 36 may performa copy function 142 to transfer the remaining active memory addresses tothe remapped addresses in the 1-bank memory mapping scheme. The copyfunction 142 may take place in a manner similar to the copy function 122discussed above.

The memory shut-down process may, in certain embodiments, be employed bythe electronic device 10 for power management and/or thermal managementunder specific circumstances. In particular, FIG. 14 illustrates aflowchart 150 describing an embodiment of such a method for powermanagement and/or thermal management. In a first block 152, theelectronic device 10 may enter an idle state or may exceed a temperaturethreshold. In either case, the memory controller 36, the processor(s)12, the OS running on the processor(s) 12, and/or software running onthe OS may determine that power consumption should be reduced to savepower and/or to prevent additional heat from being generated.

As such, in block 154, the OS may reduce memory usage using any of avariety of measures, which may include limiting the frame rate ofgraphics on the display 18, consolidating the working set of memory tofit into smaller areas of memory, and/or reducing unbound memory.Additionally or alternatively, the electronic device 10 may enter anidle or reduced-memory-usage state when the power source 26 switchesfrom AC power to battery power, which may involve automatically reducingthe video frame rate. In certain embodiments, the electronic device 10may reduce memory usage by backing up memory data onto the nonvolatilestorage 16, thereafter indicating that the higher order physicaladdresses to which the data corresponds is no longer in use.

Thereafter, in block 156, the memory controller 36 may perform one ofthe memory remapping procedures described above and shut down a portionof the memory 14 (e.g., bank 2), conserving power and/or reducing heat.In some embodiments, certain DIMM addresses on the memory bank 40 thatis to be shut down (e.g., bank 2) may be put to use as cache before thatmemory bank 40 is shut down.

As discussed above with reference to FIG. 8, in addition to beingdeactivated to conserve power, the memory banks 40A, 40B, and 40C mayalso be reactivated to increase available memory. FIGS. 15 and 16illustrate memory remapping diagrams for remapping, on-the-fly, fromfewer memory banks 40A, 40B, and 40C to more memory banks 40A, 40B, and40C. Turning first to FIG. 15, a memory remapping diagram 160illustrates a process for transitioning to the two-bank memory mappingscheme from the one-bank memory mapping scheme. A column labeled“Physical Address” lists physical addresses. Physical addresses that arenot in use (e.g., 16-23), which may be referred to as “inactive physicaladdresses,” are illustrated with dashed formatting. A column labeled“Bank” lists the memory banks 40A, 40B, and 40C, which, for explanatorypurposes only, each hold eight DIMM addresses. In practice, it should beunderstood that the size of the memory banks 40 and their memoryaddresses may be much larger, and may represent any size chunk of memorythat may be manipulated by the memory controller 36 (e.g., a cache lineor page). A column labeled “DIMM Address (2 Banks)” illustrates thetwo-bank memory mapping scheme, and a column labeled “DIMM Address (1Bank)” illustrates the one-bank memory mapping scheme.

When the electronic device 10 transitions from the one-bank memorymapping scheme to the two-bank memory mapping scheme, the memorycontroller 36 may perform a copy function 162. The memory controller 36may determine which DIMM addresses of bank 0 currently store dataassociated with physical addresses that, in the two-bank memory mappingscheme, map to DIMM addresses of bank 1. The memory controller 36 mayread from these DIMM addresses and may write their contents onto atleast the DIMM addresses associated with these physical addresses of thetwo-bank memory mapping scheme. In certain embodiments, the memorycontroller 36 may write such data onto both the DIMM addresses of theone-bank memory mapping scheme and of the two-bank memory mappingscheme.

Turning next to FIG. 16, a memory remapping diagram 170 illustrates aprocess for transitioning to the three-bank memory mapping scheme fromthe two-bank memory mapping scheme. A column labeled “Physical Address”lists physical addresses. A column labeled “Bank” lists the memory banks40A, 40B, and 40C, which, for explanatory purposes only, each hold eightDIMM addresses. In practice, it should be understood that the size ofthe memory banks 40 and their memory addresses may be much larger, andmay represent any size chunk of memory that may be manipulated by thememory controller 36 (e.g., a cache line or page). A column labeled“DIMM Address (3 Banks)” illustrates the three-bank memory mappingscheme, and a column labeled “DIMM Address (2 Banks)” illustrates thetwo-bank memory mapping scheme.

In the manner described above, when the electronic device 10 transitionsfrom the two-bank memory mapping scheme to the three-bank memory mappingscheme, the memory controller 36 may perform a copy function 172. Thememory controller 36 may determine which DIMM addresses of banks 0 and 1currently store data associated with physical addresses that, in thethree-bank memory mapping scheme, map to DIMM addresses of bank 2. Thememory controller 36 may read from these DIMM addresses and may writetheir contents onto at least the DIMM addresses associated with thesephysical addresses of the three-bank memory mapping scheme. In certainembodiments, the memory controller 36 may write such data onto both theDIMM addresses associated with these physical addresses for both thetwo-bank memory mapping scheme and the three-bank memory mapping scheme.

Referring to both FIGS. 15 and 16, it should be recalled that in certainembodiments, the memory controller 36 may have swapped, rather thandestructively copied, the data from the shut-down memory bank 40 (e.g.,bank 2 or bank 1) into the newly remapped memory banks 0 and/or 1. Forsuch embodiments, the memory bank 40 that was shut down may have beenplaced in a low-power self-refresh mode. As such, the shut-down memorybank 40 may have preserved the data stored in its physical addresses.

This data may be recovered when the shut-down memory bank 40 isreactivated and remapped (e.g., as according to FIG. 15 or 16). Ratherthan destructively copying certain physical addresses from hardwarememory locations on, for example, memory bank 0 or 1 onto memory bank 1or 2, such data may instead be swapped. Although performing such a swapfunction rather than a destructive copy function may involve additionalmemory buffer(s) to hold the physical addresses being swapped while theswap is taking place, swapping may enable the previously inaccessibledata to be accessible again without need for restoring such data fromnon-volatile storage 16.

In some embodiments, the electronic device 10 may balance performanceneeds with memory usage needs to reduce the amount of power employed bythe electronic device 10 in certain situations, as illustrated in aflowchart 180 of FIG. 17. In a first block 182, the memory controller36, the processor(s) 12, the OS running on the processor(s) 12, and/orsoftware running on the OS may assess memory usage and performance needsof the electronic device 10. This may be accomplished, for example, bymonitoring the amount of memory currently in use and/or usingperformance counters tracked by the electronic device 10. As noted bydecision blocks 184 and 186, if performance needs are low and memoryneeds are low, the electronic device 10 may undertake the remappingprocedures to power down one or more of the memory banks 40A, 40B, and40C according to the techniques described above in block 188. If theperformance needs are low and the memory needs are high, the electronicdevice 10 may reduce the clock frequencies of the memory banks 40A, 40B,and 40C and/or the memory buses 42, 44, and 46 in block 190.Additionally or alternatively, the electronic device 10 may perform thesystem idle procedure described above with reference to FIG. 14 toreduce the amount of memory in use, before performing one of theremapping and memory shut-down techniques described above.

If, as indicated by decision blocks 184 and 192, the performance needsof the electronic device 10 are high but the memory usage is low, thememory 14 may be remapped and an additional memory bank 40A, 40B, or 40Cmay be reactivated, as shown by block 194. Though not all of theadditional DIMM addresses may be used by the electronic device 10, bydistributing the memory data across additional memory banks 40, thememory access bandwidth may be increased. The memory controller 36 mayperform the remapping procedure in a manner such as described above withreference to FIGS. 15 and/or 16. If performance needs are high andmemory usage is high, as indicated by decision blocks 184 and 192, allmemory banks 40A, 40B, and 40C may be made active and in use, as shownby block 196.

Performance may be improved further by reducing the number of certaintypes of accesses to the memory banks 40. In particular, the DIMMaddresses may be accessible via a row address selection (RAS), a columnaddress selection (CAS), and a device selection (DEV). Since changingmemory rows through changes in RAS may produce greater latency thanchanging memory columns through changes in CAS, on-the-fly memoryremapping techniques may be employed that reduce the number of RASchanges and increase the number of CAS changes. Techniques forperforming such memory remapping are discussed in greater detail below.

To reduce row changes and unnecessary copying between memory banks 40when one or more of the memory banks 40 is shut down, the memorycontroller 36 may remap certain address bits when certain memory isrequested by the processor(s) 12. By way of example only, as illustratedin FIG. 18, a cache line address 200 that corresponds to an addressspace of 256 cache-line addresses may include 8 bits, labeled A0 to A7in order of significance. It should be appreciated that, in practice,cache line addresses may be longer or shorter. Indeed, the presentembodiments illustrated in FIGS. 18, 19A-C, 21A-E, and 22A-B are shownto include 8 bits to encode an address space of 256 cache lines for easeof explanation only. For a system that allows one or two memory banks 40to be powered off, copying of data between DRAM devices should bereduced. For example, if one-half the memory of the memory banks 40 isto be powered down, then no more than one-half the memory should berelocated when the powering down occurs.

For example, the electronic device 10 may operate in 3 differentconfigurations, in which either 1, 2, or 4 memory banks 40 remainspowered, and where each configuration doubles the amount of memoryavailable (e.g., each memory bank 40 is of equal size). In eachconfiguration, unnecessary copying operations may be avoided by applyingthree different address-mapping schemes. These schemes may enable a highdegree of memory bank 40 interleaving in each mode, while reducing rowchanges regardless of the mode.

In one embodiment, the memory controller 36 may map the cache lineaddress 200 in a manner that limits mapping changes to only two bitseach time the configuration changes. FIGS. 19A-C represent mappings fora configuration starting with four memory banks 40 of equal size. By wayof example only, as illustrated in FIGS. 19A-C, a cache line address 200that corresponds to an address space of 256 cache-line addresses mayinclude 8 bits, labeled A0 to A7 in order of significance. It should beappreciated that, in practice, cache line addresses may be longer orshorter. Indeed, the present embodiments illustrated in FIGS. 18, 19A-C,21A-E, and 22A-B are shown to include 8 bits to encode an address spaceof 256 cache lines for ease of explanation only. Moreover, for ease ofexplanation only, the cache line address 200 of FIGS. 21A-C each map 64cache addresses.

FIG. 19A represents a configuration when all four memory banks 40 areactive, FIG. 19B represents a configuration when two of the memory banks40 are active, and FIG. 19C represents a configuration when only one ofthe memory banks 40 is active. In FIGS. 19A-C, R0-R2 correspond to RASbits, C0-C2 correspond to CAS bits, and D0 and D1 correspond to DEVbits. In certain embodiments, when all four memory banks 40 are active,the system memory map for the mode may map cache addresses 128-255 tothe two fastest memory banks 40 and cache addresses 0-63 and 64-127respectively to slower memory banks 40. When only two of four memorybanks 40 of equal size are active, the system memory map for the modemay map cache addresses 0-63 and 64-127 respectively to slower memorybanks 40, and when only one of the four memory banks 40 is active, thesystem memory map for the mode may map cache addresses 0-63 to theslowest of the memory banks 40.

As apparent from the mappings of FIGS. 19A-C, in each configurationchange, one of the bits may be relocated to a portion of the systemaddress-map that will be powered-down. Since the DEV bits D0 and D1reside in the lower-ordered bits to achieve maximum memory bank 40interleaving when all four memory banks 40 are active (FIG. 19A), andthe powering-down of a memory bank 40 implies that that memory bank 40may no longer be accessed, one of the DEV bits may be relocated from thelower-ordered bits to one of the higher-ordered bits that will no longerbe accessed (FIG. 19B), in order to cause accesses to the disabledmemory bank 40 not to occur.

To reduce row changes, the bit that should be exchanged with a DEV bitshould be a CAS bit, implying that the CAS bit formerly used thehigher-ordered bits of the cache address. Thus, to reduce copying, RASmust change more frequently during streaming with multiple memory banks40 enabled that might otherwise be achieved, but under no circumstancesshould it change more frequently than when only a single memory bank 40is enabled. Thus, in changing from the four-memory-bank configuration ofFIG. 19A to the two-memory-bank configuration of FIG. 19B, cache lineaddress bits A1 and A7 are swapped. In changing from the two-memory-bankconfiguration of FIG. 19B to the one-memory-bank configuration of FIG.19C, cache line address bits A1 and A6 are swapped.

Accordingly, the mapping of FIGS. 19A-C result in the followingtranslation between cache line addresses and system addresses, in whichthe notation ([#],[#],[#]) [#] corresponds to ([RAS], [CAS], [DEV])[system address]:

TABLE 1 four-memory-bank two-memory-bank one-memory-bank Cacheconfiguration configuration configuration Address (FIG. 19A) (FIG. 19B)(FIG. 19C) 8 (1, 0, 0) 8 (1, 0, 0) 8 (1, 0, 0) 8 9 (1, 0, 1) 72 (1,0, 1) 72 (1, 1, 0) 9 10 (1, 0, 2) 136 (1, 2, 0) 10 (1, 2, 0) 10 11 (1,0, 3) 200 (1, 2, 1) 74 (1, 3, 0) 11 12 (1, 4, 0) 12 (1, 4, 0) 12 (1, 4,0) 12 13 (1, 4, 1) 76 (1, 4, 1) 76 (1, 5, 0) 13 14 (1, 4, 2) 140 (1, 6,0) 14 (1, 6, 0) 14 15 (1, 4, 3) 204 (1, 6, 1) 78 (1, 7, 0) 15

As seen in Table 1, regardless of the mode, there are eight accessesbetween row changes.

In some embodiments, the electronic device 10 may have only 3 memorybanks 40, one memory bank 40 of which may have more memory than theremaining two memory banks 40. In some embodiments, a faster memory bank40 may have the same capacity as the combined capacity of the two slowermemory banks 40 (e.g., the fast memory bank 40 may have twice thecapacity of each of the two remaining slow memory devices 40). For suchembodiments, the above design strategy can still be employed by mappingDEV[0] (D0) to the additional CAS bit (e.g., CAS[3] (C3)) on the fasterof the memory banks 40.

To carry out on-the-fly memory remapping when certain memory is to bepowered down, the electronic device 10 may follow a process such asdisclosed by a flowchart 210 of FIG. 20. The flowchart 210 may beginwhen the electronic device 10 is operating in a full memory usage mode(e.g., if four memory banks 40 are present, all four memory banks 40 maybe active). Accordingly, when the flowchart 210 begins, the memorycontroller 36 may map the memory banks 40 according to a scheme such asillustrated in FIG. 19A. The electronic device 10 may prepare to powerdown half of the memory 14 available to the electronic device 10 (block212) using any suitable technique, as discussed in greater detail above.Since faster memory banks 40 typically may consume greater amounts ofpower, the electronic device 10 generally may initially choose to powerdown the fastest memory bank(s) 40.

Prior to powering down the memory bank(s) 40, the memory controller 36may remap the cache line addresses 200 (block 214) according to a schemethat only changes two bits of the cache line address 200 (e.g., asillustrated in FIG. 19B). Thereafter, the memory controller 36 may copycertain data from the memory bank(s) 40 that will be powered down to thememory banks 40 that will remain active, in the manners discussed above,before powering down the chosen memory bank(s) 40 (block 216).

When appropriate, the electronic device 10 may determine to power downhalf of the remaining memory 14 (block 218) using any suitabletechnique, such as discussed above. Since faster memory banks 40typically may consume greater amounts of power, the electronic device 10generally may choose to power down the faster of the remaining memorybank(s) 40. By way of example, if the electronic device 10 has a totalof four memory banks 40 of equal size, only the slowest memory bank 40may be selected to remain active. The memory controller 36 may nextremap the cache line addresses 200 (block 220) according to a schemethat only changes two bits of the cache line address 200 (e.g., asillustrated in FIG. 19C). Thereafter, the memory controller 36 may copycertain data from the memory bank(s) 40 that will be powered down to thememory bank(s) 40 that will remain active, in the manners discussedabove, before powering down the chosen memory bank(s) 40 (block 222).

In certain other embodiments, the electronic device 10 may employ atechnique in which each mode adds or subtracts equal amounts of memoryfrom system memory. For example, certain embodiments of the electronicdevice 10 may have 3 memory banks 40 of equal capacity. To reducecopying, only two address-mapping bits may be changed between modes in amanner similar to those discussed above.

For example, FIGS. 21A-E represent mappings for a configuration startingwith three memory banks 40 of equal size. In particular, FIGS. 21A-Crepresent certain variations of a configuration when all three memorybanks 40 are active, FIG. 21D represents a configuration when two of thememory banks 40 are active, and FIG. 21E represents a configuration whenonly one of the memory banks 40 is active. In FIGS. 21A-E, R0-R2correspond to RAS bits, C0-C2 correspond to CAS bits, and D0 and D1correspond to DEV bits. By way of example only, as illustrated in FIGS.21A-E, a cache line address 200 that corresponds to an address space of256 cache-line addresses may include 8 bits, labeled A0 to A7 in orderof significance. It should be appreciated that, in practice, cache lineaddresses may be longer or shorter. Indeed, the present embodimentsillustrated in FIGS. 18, 19A-C, 21A-E, and 22A-B are shown to include 8bits to encode an address space of 256 cache lines for ease ofexplanation only. Moreover, for ease of explanation only, the cache lineaddress 200 of FIGS. 21A-C each map 64 cache addresses. That is, incertain embodiments, when all three memory banks 40 are active, thesystem memory map for the mode may map cache addresses 128-191 to thefastest memory bank 40 and cache addresses 0-63 and 64-127 respectivelyto slower memory banks 40. When only two of three memory banks 40 ofequal size are active, the system memory map for the mode may map cacheaddresses 0-63 and 64-127 respectively to slower memory banks 40, andwhen only one of the three memory banks 40 is active, the system memorymap for the mode may map cache addresses 0-63 to the slowest of thememory banks 40.

Unlike the configuration of FIGS. 19A-C, in which a single mapping (FIG.19A) applies for all of the cache addresses in the four-memory-bankconfiguration, when all three memory banks 40 are active, a differentmapping applies depending on the states of certain cache line address200 bits. In particular, when all three memory banks 40 are active, amapping according to FIG. 21A may be applied when cache line address 200bits A7=1 and A1=1; a mapping according to FIG. 21B may be applied whencache line address 200 bits A7=0 and A1=1; and a mapping according toFIG. 21C may be applied when cache line address 200 bits A7=0 and A1=0.

At first glance, it may appear that the rule of only changing themappings of two cache line address 200 bits during a mode change hasbeen violated. As shown in FIGS. 21B and 21D, when switching between thethree-memory-bank configuration and the two-memory-bank configurationwhen A7=0 and A1=1, the mappings of A7, A6, A2, and A1 have all changed.However, since the values of A7 and A1 are known (e.g., A7=0 and A1=1),fixed values may be substituted as respectively shown in FIGS. 22A and22B. From FIGS. 22A and 22B, it may be seen that only A6 and A0 havechanged mappings between the three-memory-bank configuration and thetwo-memory-bank configuration.

The mapping of FIGS. 21A-E result in the following translation betweencache line addresses and system addresses, in which the notation([#],[#],[#]) [#] corresponds to ([RAS], [CAS], [DEV]) [system address]:

TABLE 2 three-memory-bank two-memory-bank one-memory-bank Cacheconfiguration configuration configuration Address (FIGS. 21A-E) (FIG.21B) (FIG. 21C) 8 (1, 0, 0) 8 (1, 0, 0) 8 (1, 0, 0) 8 9 (1, 0, 1) 72 (1,0, 1) 72 (1, 1, 0) 9 10 (1, 0, 2) 136 (1, 2, 0) 10 (1, 2, 0) 10 11 (1,1, 2) 137 (1, 2, 1) 74 (1, 3, 0) 11 12 (1, 4, 0) 12 (1, 4, 0) 12 (1, 4,0) 12 13 (1, 4, 1) 76 (1, 4, 1) 76 (1, 5, 0) 13 14 (1, 4, 2) 140 (1, 6,0) 14 (1, 6, 0) 14 15 (1, 5, 2) 141 (1, 6, 1) 78 (1, 7, 0) 15

In Table 2, as in Table 1 above, regardless of the mode, there are eightaccesses between row changes.

To carry out on-the-fly memory remapping when memory is to be powereddown in one-third increments, the electronic device 10 may follow aprocess such as disclosed by a flowchart 230 of FIG. 23. The flowchart230 may begin when the electronic device 10 is operating in a fullmemory usage mode (e.g., if three memory banks 40 of equal size arepresent, all three memory banks 40 may be active). Accordingly, when theflowchart 230 begins, the memory controller 36 may map the memory banks40 according to a scheme such as illustrated in FIGS. 21A-C, dependingon the state of cache line address 200 bits A7 and A1. The electronicdevice 10 may prepare to power down one-third of the memory 14 availableto the electronic device 10 (block 232) using any suitable technique, asdiscussed in greater detail above. Since faster memory banks 40typically may consume greater amounts of power, the electronic device 10generally may initially choose to power down the fastest memory bank(s)40.

Prior to powering down the memory bank(s) 40, the memory controller 36may remap the cache line addresses 200 (block 234) according to a schemethat only changes two bits of the cache line address 200 (e.g., asillustrated in FIG. 21D and as demonstrated above). Thereafter, thememory controller 36 may copy certain data from the memory bank(s) 40that will be powered down to the memory banks 40 that will remainactive, in the manners discussed above, before powering down the chosenmemory bank(s) 40 (block 236).

When appropriate, the electronic device 10 may determine to power downhalf of the remaining memory 14 such that only one-third of the totalmemory 14 remains (block 218) using any suitable technique, such asthose discussed above. Since faster memory banks 40 typically mayconsume greater amounts of power, the electronic device 10 generally maychoose to power down the faster of the remaining memory bank(s) 40. Byway of example, if the electronic device 10 has a total of three memorybanks 40 of equal size, only the slowest memory bank 40 may be selectedto remain active. The memory controller 36 may next remap the cache lineaddresses 200 (block 220) according to a scheme that only changes twobits of the cache line address 200 (e.g., as illustrated in FIG. 21E).Thereafter, the memory controller 36 may copy certain data from thememory bank(s) 40 that will be powered down to the memory bank(s) 40that will remain active, in the manners discussed above, before poweringdown the chosen memory bank(s) 40 (block 222).

It should be understood that the specific embodiments described abovehave been shown by way of example, and that these embodiments may besusceptible to various modifications and alternative forms. For example,the techniques described herein by way of example may similarly apply tovarious other quantities of memory. That is, the techniques describedabove may also be applied to perform on-the-fly memory mapping andre-mapping from four or more memory banks 40 to three or fewer.Moreover, it should be appreciated that in addition to individuallycontrollable memory banks 40, any memory of any size that may beseparately deactivated (in which portions of the memory may bedeactivated while other portions remain active) may be employed.Additionally, for example, when transitioning between memory mappingmodes, copying may be completed by the memory controller 36 in a mannerthat is hidden from the operating system (OS) or software of theelectronic device 10, or copying may be completed in manner that iscontrolled by the OS or software, provided each copy is atomic (e.g., aread from a first DIMM address at a first memory mapping may beimmediately followed by writes to DIMM addresses of both the first andsecond memory mapping). It should be further understood that the claimsare not intended to be limited to the particular forms disclosed, butrather to cover all modifications, equivalents, and alternatives fallingwithin the spirit and scope of this disclosure.

1. An electronic device comprising: a plurality of memory banks capableof storing data in hardware memory locations, wherein at least one ofthe plurality of memory banks is capable of being deactivated while atleast another of the plurality of memory banks remains active; one ormore processors capable of requesting the data via memory requests tophysical memory addresses; and a memory controller communicablyinterposed between the plurality of memory banks and the one or moreprocessors, wherein the memory controller is capable of receiving thememory requests to physical memory addresses from the one or moreprocessors, translating the physical memory addresses to the hardwarememory locations using a first memory mapping function when a firstnumber of the plurality of memory banks is active, translating thephysical memory addresses to the hardware memory locations using asecond memory mapping function when a second number of the plurality ofmemory banks is active, and, when one of the plurality of memory banksis to be deactivated, copying data from the one of the plurality ofmemory banks that is to be deactivated to an active remainder of theplurality of memory banks but not copying data between any two of theactive remainder of the plurality of memory banks.
 2. The electronicdevice of claim 1, wherein the first number of the plurality of memorybanks comprises a multiple of three memory banks and the first memorymapping function is configured to map the physical addresses to thehardware memory locations such that no two physical addresses associatedwith contiguous logical memory addresses are mapped to a single one ofthe plurality of memory banks
 3. The electronic device of claim 1,wherein the second number of the plurality of memory banks comprisesfewer than the first number of the plurality of memory banks and thesecond memory mapping function is configured to map the physicaladdresses to the hardware memory locations such that at least onehardware memory location of each of the active remainder of theplurality of memory banks maps to at least one physical address that,under the first memory mapping function, would be mapped to a hardwarememory location of the one of the plurality of memory banks that is tobe deactivated.
 4. The electronic device of claim 1, wherein the secondnumber of the plurality of memory banks comprises fewer than the firstnumber of the plurality of memory banks and the second memory mappingfunction is configured to map the physical addresses to the hardwarememory locations such that no hardware memory location of one of theactive remainder of the plurality of memory banks maps to a physicaladdress that, under the first memory mapping function, would be mappedto a hardware memory location of a different one of the active remainderof the plurality of memory banks
 5. The electronic device of claim 1,wherein the memory controller is configured to copy data from a hardwarememory location of the one of the plurality of memory banks that is tobe deactivated to both a hardware memory location of the activeremainder of the plurality of memory banks and back to the hardwarememory location of the one of the plurality of memory banks that is tobe deactivated from which the data was copied.
 6. The electronic deviceof claim 1, wherein the memory controller is configured to swap databetween the one of the plurality of memory banks that is to bedeactivated to an active remainder of the plurality of memory banks andto deactivate the one of the plurality of memory banks that is to bedeactivated by causing the one of the plurality of memory banks that isto be deactivated to enter a self-refresh mode.
 7. The electronic deviceof claim 1, wherein the second number of the plurality of memory banksthat is active comprises one less than the first number of the pluralityof memory banks that is active.
 8. A method of managing powerconsumption in an electronic device comprising: determining whether theelectronic device is operating with excess memory usage based at leastin part on memory operation criteria of the electronic device using amemory controller, one or more processors, an operating system runningon the one or more processors, or software running on the operatingsystem, or any combination thereof; when the electronic device isoperating within a threshold of excess memory usage, reducing a clockspeed or an operating voltage, or a combination thereof, of memory ofthe electronic device using the memory controller; and when theelectronic device is operating above the threshold of excess memoryusage, deactivating one of a plurality of portions of the memory of theelectronic device and dynamically remapping the remaining of theplurality of portions of the memory using the memory controller.
 9. Themethod of claim 8, wherein the memory operation criteria compriseperformance counters, an operational state of the electronic device, amemory usage history of the electronic device, an expected memory usageof the electronic device, thermal limitations of the electronic device,memory stalls, or paging activities, or any combination thereof.
 10. Themethod of claim 8, comprising: determining whether the electronic deviceis operating with insufficient memory usage based at least in part onthe memory operation criteria using the memory controller, the one ormore processors, the operating system running on the one or moreprocessors, or the software running on the operating system, or anycombination thereof; when the electronic device is operating within athreshold of insufficient memory usage, increasing the clock speed orthe operating voltage, or the combination thereof, of the memory of theelectronic device using the memory controller; and when the electronicdevice is operating above the threshold of insufficient memory usage,reactivating a previously deactivated one of the plurality of portionsof the memory of the electronic device and dynamically remapping thereactivated one of the plurality of portions of the memory using thememory controller.
 11. The method of claim 8, wherein the threshold ofexcess memory usage comprises a threshold amount of time of excessmemory usage or a threshold value of excess memory usage, or acombination thereof.
 12. The method of claim 8, wherein the threshold ofexcess memory usage comprises a threshold amount of time that a physicalmemory address within a range of physical memory addresses has not beenrequested for access by the electronic device.
 13. An electronic devicecomprising: a plurality of memory banks having hardware memorylocations, wherein at least one of the plurality of memory banks isconfigured to be selectively deactivated; one or more processors capableof issuing memory requests via physical memory addresses; and a memorycontroller configured to dynamically map the physical memory addressesto the hardware memory locations using a first mapping equation whenthree memory banks are active and a second mapping equation when twomemory banks are active, wherein the first mapping equation comprisesthe following relationships:BankIndex=Floor(PAddr/TotalBanks) andDIMMAddr=MOD(PAddr*BankSize, TotalMemory)+BankIndex, where PAddrrepresents a physical memory address, DIMMAddr represents the hardwarememory location to which the physical memory address is mapped whenthree memory banks of the plurality of memory banks are active, BankSizerepresents a quantity of physical memory addresses of each of theplurality of memory banks, TotalBanks represents a total number ofactive memory banks of the plurality of memory banks, and TotalMemoryrepresents a total number of hardware memory locations among the activememory banks of the plurality of memory banks
 14. The electronic deviceof claim 13, wherein the second mapping equation comprises the followingrelationships: ALT_DIMMAddr3_2 = If(DIMMAddr < ReducedMemory3_2, ThenDIMMAddr, Else If(BankReindex3_2 < FirstBankEntries3_2, , ThenFirstBankOffset3_2 + BankReindex3_2, Else SecondBankOffset3_2 +BankReindex3_2)) where: BankReindex3_2 = If(DIMMAddr < ReducedMemory3_2,Then −1,  ; Else DIMMAddr − ReducedMemory3_2) FirstBankEntries3_2 =Floor(BankSize / TotalBanks) ; FirstBankOffset3_2 = ; andFloor(ReducedBanks3_2 * BankSize / TotalBanks) SecondBankOffset3_2 =FirstBankEntries3_2 + BankSize −Floor(BankSize / TotalBanks) + 3 ,

where ALT DIMMAddr3_2 represents a storage cell to which a physicaladdress is mapped when two memory banks are active, ReducedMemory3_2represents a quantity of hardware memory locations available across theactive two memory banks, and ReducedBanks3_2 represents a number of theactive two memory banks
 15. The electronic device of claim 13, whereinthe second mapping equation comprises the following relationships:DIMMAddrBank=Floor(DIMMAddr/BankSize) andPAddr=MOD(DIMMAddr*TotalBanks, TotalMemory)+DIMMAddrBank
 16. Theelectronic device of claim 13, wherein the memory controller isconfigured to dynamically map the physical memory addresses to hardwarememory locations using a third mapping equation when one memory bank isactive, wherein the third mapping equation comprises the followingrelationships: ALT_DIMMAddr2_1 = If(ALT_DIMMAddr3_2 < ReducedMemory2_1,Then ALT_DIMMAddr3_2, Else If(BankReindex2_1 < FirstBankEntries2_1, ,Then FirstBankOffset2_1 + Bank_Reindex2_1, Else BankReindex2_1)) where:BankReindex2_1 = If(ALT_DIMMAddr3_2 < ReducedMemory2_1, Then −1,  ; ElseALT_DIMMAddr3_2 − ReducedMemory2_1) FirstBankEntries2_1 = Floor(BankSize/ TotalBanks) + 1 ; and FirstBankOffset2_1 = Floor(ReducedBanks2_1 *BankSize / TotalBanks) + 1 ,

where ALT_DIMMAddr2_1 represents the hardware memory location to which aphysical address is mapped when one memory bank is active,ReducedMemory2_1 represents a quantity of hardware memory locationsavailable across the one active memory bank, and ReducedBanks2_1represents the number of the one active memory bank.
 17. A methodcomprising: determining to deactivate a portion of active memory of anelectronic device based at least in part on memory operating criteria ofthe electronic device; selecting the portion of active memory to bedeactivated; copying data from hardware memory locations on the portionof active memory selected to be deactivated to hardware memory locationson other portions of active memory using a memory controller based atleast in part on a memory mapping equation using the memory controller;and deactivating the portion of the active memory selected to bedeactivated using the memory controller; wherein the hardware memorylocations on the portion of the active memory selected to be deactivatedremain accessible at least until the portion of the active memoryselected to be deactivated is deactivated.
 18. The method of claim 17,wherein the portion of active memory to be deactivated is determined bythe memory controller based on when one or more processors lastrequested physical addresses associated with the portion of activememory to be deactivated.
 19. The method of claim 17, wherein theportion of active memory to be deactivated is selected based on a memoryportion shut-down command from one or more processors to the memorycontroller.
 20. The method of claim 17, wherein the portion of activememory to be deactivated is selected based at least in part on a balanceof bandwidth and power consumption factors.
 21. The method of claim 17,wherein the data is copied by the memory controller based at least inpart on an instruction from an operating system or software to performone or more atomic copies.
 22. An electronic device comprising: memoryhaving portions configured to be separately deactivated; data processingcircuitry configured to determine when one of the portions of the memoryis to be deactivated; and a memory controller configured to remap cacheline addresses associated with the memory when the one of the portionsof the memory is to be deactivated such that no more than two bits ofthe cache line addresses are changed.
 23. The electronic device of claim22, wherein the memory comprises four memory segments, at least two ofwhich are configured to form the one of the portions of the memory thatis to be deactivated, wherein the memory controller is configured toremap the cache line addresses by swapping a cache line address bitassociated with the memory segments with a cache line address bitassociated with a memory column.
 24. The electronic device of claim 23,wherein the cache line address bit associated with the memory segmentsis a bit associated with two memory segments that form the portion ofthe memory that is to be deactivated and the cache line address bitassociated with a memory column is a second-lowest-order column addressselection bit.
 25. The electronic device of claim 22, wherein the memorycomprises two memory segments, at least one of which is configured toform the one of the portions of the memory that is to be deactivated,wherein the memory controller is configured to remap the cache lineaddresses by swapping a cache line address bit associated with thememory segments with a cache line address bit associated with a memorycolumn, wherein the cache line address bit associated with the memorysegments is a bit associated with the memory segment that forms the oneof the portions of the memory that is to be deactivated and the cacheline address bit associated with a memory column is a lowest-ordercolumn address selection bit.
 26. A method comprising: determining,using data processing circuitry, to power down a memory segmentrepresenting one third of memory; remapping, using a memory controller,cache line addresses associated with the memory such that no more thantwo bits of the cache line addresses are changed; copying, using thememory controller, data from hardware memory locations of the memorysegment that is to be powered down to hardware memory locations of theremaining two-thirds of memory; and powering down, using the memorycontroller, the memory segment.
 27. The method of claim 26, wherein thememory segment is determined to be powered down using the dataprocessing circuitry, wherein the memory controller comprises the dataprocessing circuitry.
 28. The method of claim 26, wherein the cache lineaddresses are remapped such that a column address selection bit ischanged to a memory segment selection bit.
 29. The method of claim 26,wherein the cache line addresses are remapped such that a memory segmentselection bit is changed to a column address selection bit.
 30. Themethod of claim 26, wherein the cache line addresses are remapped fromtwo or more concurrent mappings that vary depending on a state of acache line address bit to a single mapping independent of the state ofthe cache line address bit.